package com.maxd.respository.FreeOfCharge;



import com.maxd.model.FreeOfCharge;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;

import java.util.Date;

public interface FreeOfChargeRepository extends Repository<FreeOfCharge, Long> {


    @Query(value = "select * from free_of_charge",
            countQuery = "select count(*) from free_of_charge"
            ,nativeQuery = true)
    Page<FreeOfCharge> selectFreeOfChargeList(Pageable pageable);

    @Query(value = "select 1 from free_of_charge where free_of_charge.time=:time limit 1"
            ,nativeQuery = true)
    Integer selectByTime(@Param("time") Date time);

}